package com.nbsaas.boot.wms.data.entity;

import com.nbsaas.boot.code.annotation.*;
import com.nbsaas.boot.jpa.data.entity.AbstractEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import lombok.Data;
import org.hibernate.annotations.Comment;

import java.math.BigDecimal;

@CreateByUser
@ComposeView
@Data
@FormAnnotation(title = "仓库", model = "仓库")
@Entity
@Table(name = "bs_warehouse")
@Comment("仓库表")
public class Warehouse extends AbstractEntity {

    @Comment("仓库编码")
    @SearchItem(name = "code", key = "code", label = "仓库编码")
    @FormField(title = "仓库编码", sortNum = "1", grid = true, required = true)
    @Column(length = 50, nullable = false, unique = true)
    private String code;

    @Comment("仓库名称")
    @SearchItem(name = "name", key = "name", label = "仓库名称")
    @FormField(title = "仓库名称", sortNum = "2", grid = true, required = true)
    @Column(length = 200, nullable = false)
    private String name;

    @Comment("仓库类型")
    @FormField(title = "仓库类型", sortNum = "3", grid = true, type = InputType.select)
    @Column(length = 20)
    private String type; // MAIN-主仓库, BRANCH-分仓库, VIRTUAL-虚拟仓库

    @Comment("仓库地址")
    @FormField(title = "仓库地址", sortNum = "4", grid = true)
    @Column(length = 500)
    private String address;

    @Comment("联系人")
    @FormField(title = "联系人", sortNum = "5", grid = true)
    @Column(length = 100)
    private String contactPerson;

    @Comment("联系电话")
    @FormField(title = "联系电话", sortNum = "6", grid = true)
    @Column(length = 50)
    private String contactPhone;

    @Comment("仓库面积(平方米)")
    @FormField(title = "仓库面积(平方米)", sortNum = "7", grid = true, type = InputType.el_input_number)
    private BigDecimal area;

    @Comment("仓库状态")
    @FormField(title = "仓库状态", sortNum = "8", grid = true, type = InputType.select)
    @Column(length = 20)
    private String status; // ACTIVE-启用, INACTIVE-停用

    @Comment("排序")
    @FormField(title = "排序", sortNum = "9", grid = true, type = InputType.el_input_number, sort = true)
    private Integer sort;

    @Comment("备注")
    @FormField(title = "备注", sortNum = "10", type = InputType.richText, col = 23)
    @Column(length = 1000)
    private String note;
} 